home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
lisp
/
eulisp
/
mpfeel.lha
/
MPFeel
/
Plurals
/
proc_pair.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-27
|
3KB
|
102 lines
/*
* Paired Processors
*
* Author: S.C.Merrall
*
* File: proc_pair.h
*
* Contents: Definitions and Declarations
*
* Description: The paired processors suuplys a set of macros which
* are used in place of references to iproc, nproc etc.
* There will also be versions of the Xnet statements
* At the moment there is a new version of seq_net
* called pair_seq_net. The affect is the array has half
* as many elements (but sort of twice as much memory)
* This has been devised to for a garbage collector
* using a stop and copy mecahnsim bewteen the `on'
* `off' processor sets. The processor sets are then
* exchanged
*
* Change History:
*
* Date Name Comment
* -------- ---- -------
* 17:01:92 SCM Created
*
*/
/* Paired Processor Initialisation Function */
/* ====== ========= ============== ======== */
#ifdef __STDC__
extern void init_proc_pair( void );
#else
extern void init_proc_pair( );
#endif
/* External Declarartions of Globals */
/* ======== ============= == ======= */
/* Accessible to Programmer */
extern plural int PP_iproc;
extern int PP_nproc;
extern plural int PP_ixproc;
extern int PP_nxproc;
extern plural int PP_iyproc;
extern int PP_nyproc;
/* Internal Only */
extern int PP_left_right_proc;
extern plural int PP_active_set;
extern plural int PP_which_way;
/* Macros and Constants */
/* ====== === ========= */
#define PP_proc(PROC) proc[((PROC)*2)+PP_left_right_proc]
#define PP_router(PROCS) router[((PROCS)*2)+PP_left_right_proc]
#define PP_xnetN(DIST) xnetN[DIST]
#define PP_xnetS(DIST) xnetS[DIST]
#define PP_xnetW(DIST) xnetW[(DIST)*2]
#define PP_xnetE(DIST) xnetE[(DIST)*2]
#define PP_on_set() if (PP_active_set)
#define PP_off_set() if (!PP_active_set)
#define PP_LEFT 0
#define PP_RIGHT 1
/* Communications : There are two macros which are used to pass values
* between the two sets of processors, they will pass
* data in the correct direction depending on which
* set is active.
*
* PP_push_to: This is used to write values from the active set
* into the inactive set.
* PP_pull_to: THis is used to read value from the inactive set
* In both cases the destination, i.e. where the values
* are going to be written is the first argument.
*/
#define PP_push_to(DEST,VALUE) if (PP_which_way) xnetE[1].DEST = VALUE; \
else xnetW[1].DEST = VALUE
#define PP_pull_to(DEST,VALUE) (DEST=((PP_which_way) ? xnetE[1].VALUE \
: xnetW[1].VALUE))
#define PP_switch() PP_left_right_proc=(PP_left_right_proc+1)%2; \
PP_active_set=!PP_active_set